#include <stdio.h>
//写不出来，没思路
void pwd(char buf[][128])
{
    char userpwd[][128] = {};
    int flag = 0;
    int c = 0;
    for (int i = 0; i < 2; i++)
    {
        for (int j = 5; j < 120; j++)
        {
            if (buf[i][j] == ' ')
            {
                j += 5;
                c = 0;
                flag = 1;
            }
            if (flag == 1)
            {
                userpwd[i][c] = buf[i][j];
                c++;
            }
        }
    }
    printf("%s\n", userpwd[0]);
    printf("%s\n", userpwd[1]);
};
int safe() // 检查是否越界
{
    int flag = 0;
    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < 120; j++)
        {
            if (j == '\0')
            {
                flag = 1;
            }
            else if (flag = 0 && j == 119)
            {
                printf("越位");
                return 0;
            }
        }
        flag = 0;
    }
};
void name(char buf[][128]) // 打印用户名
{
    char user[][128]={};
    for (int i = 0; i < 2; i++)
    {
        for (int j = 5; j < 128; j++)
        {
            if (buf[i][j] == ' ')
            {
                user[i][j - 5] = '\0';
                break;
            }
            user[i][j - 5] = buf[i][j];
        }
    }
    printf("%s\n", user[0]);
    printf("%s\n", user[1]);
};

int main(int argc, char const *argv[])
{
    char buf[2][120] =
        {
            "user:hqyj pws:1234",
            "user:浙江温州 pws:王八蛋老板"};
    safe(1);
    name(buf);
    pwd(buf);
    return 0;
}





